package net.hmr_radio.hmrbot.model;

import java.io.Serializable;

import org.slim3.datastore.Attribute;
import org.slim3.datastore.Model;

import com.google.appengine.api.datastore.Key;

/**
 * 返信済み.
 * 
 * @author narazaki.daishi
 */
@Model(schemaVersion = 1)
public class Replied implements Serializable {

    private static final long serialVersionUID = 1L;

    @Attribute(primaryKey = true)
    private Key key;

    @Attribute(version = true)
    private Long version;

    private String botScreenName;

    private Long repliedStatudId;

    /**
     * Returns the key.
     * 
     * @return the key
     */
    public Key getKey() {
        return key;
    }

    /**
     * Sets the key.
     * 
     * @param key
     *            the key
     */
    public void setKey(Key key) {
        this.key = key;
    }

    /**
     * Returns the version.
     * 
     * @return the version
     */
    public Long getVersion() {
        return version;
    }

    /**
     * Sets the version.
     * 
     * @param version
     *            the version
     */
    public void setVersion(Long version) {
        this.version = version;
    }

    public String getBotScreenName() {
        return botScreenName;
    }

    public void setBotScreenName(String botScreenName) {
        this.botScreenName = botScreenName;
    }

    public Long getRepliedStatudId() {
        return repliedStatudId;
    }

    public void setRepliedStatudId(Long repliedStatudId) {
        this.repliedStatudId = repliedStatudId;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result =
            prime
                * result
                + ((botScreenName == null) ? 0 : botScreenName.hashCode());
        result = prime * result + ((key == null) ? 0 : key.hashCode());
        result =
            prime
                * result
                + ((repliedStatudId == null) ? 0 : repliedStatudId.hashCode());
        result = prime * result + ((version == null) ? 0 : version.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Replied other = (Replied) obj;
        if (botScreenName == null) {
            if (other.botScreenName != null)
                return false;
        } else if (!botScreenName.equals(other.botScreenName))
            return false;
        if (key == null) {
            if (other.key != null)
                return false;
        } else if (!key.equals(other.key))
            return false;
        if (repliedStatudId == null) {
            if (other.repliedStatudId != null)
                return false;
        } else if (!repliedStatudId.equals(other.repliedStatudId))
            return false;
        if (version == null) {
            if (other.version != null)
                return false;
        } else if (!version.equals(other.version))
            return false;
        return true;
    }

}
